package com.jian.java.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.jian.java.handler.CustomerBlock;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jiange
 * @create 2021-06-04-16:41
 */
@RestController
public class MyController {
    @GetMapping("/get")
    public String get(){
        return "get";
    }
    @GetMapping("/jian")
    @SentinelResource(value = "jian",blockHandler = "deal_hotkey")
    public String jian(@RequestParam(value = "p1",required = false)String p1,@RequestParam(value = "p2",required = false)String p2){
        return "jian";
    }
    public String deal_hotkey(String p1, String p2, BlockException e){
        return "报错了，处理了[]~(￣▽￣)~*";
    }

    @GetMapping("/ge")
    @SentinelResource(value = "ge",blockHandlerClass = CustomerBlock.class,blockHandler = "handler")
    public String ge(){
        return "建哥";
    }
}
